package com.example.daiyinuo.leetcode;

public class Demo {
    public static void main(String[] args) {
        Thread1 thread1 = new Thread1();
        Thread thread = new Thread() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    if (i % 2 == 1) {
                        System.out.println(Thread.currentThread().getName() + ":" + i);
                    }
                }
            }
        };
        thread1.start();
        thread.start();

    }
}

    class Thread1 extends Thread{
        @Override
        public void run() {
            for (int i = 0; i < 100; i++) {
                if(i % 2 == 0){
                    System.out.println(Thread.currentThread().getName()+":"+i);
                }
            }
        }
    }

